package com.mongodb.controller;

import com.mongodb.entity.User;
import com.mongodb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/insert")
    public void insert() {
        userService.insert();
    }

    @GetMapping("/findById")
    public User findById(String id) {
        return userService.findById(id);
    }

    @GetMapping("/find")
    public List<User> find() {
        return userService.find();
    }
}
